<template>
  <div>
    <div class="shop_lis_header">
      <div class="icon" @click="gotoMiste">
        <i class="iconfont">&#xe650;</i>
      </div>
      <div class="backImg">
        <img :src="shopLis.bgImg" alt="" />
      </div>
      <div class="header_logo">
        <img :src="shopLis.avatar" alt="" />
      </div>
      <div class="content">
        <div class="header" @click="showChange">
          <p class="title">
            <span class="pro_pin">品牌</span><strong>{{ shopLis.name }}</strong
            ><i class="icon_nav"></i>
          </p>
        </div>
        <div class="txt">
          <p class="shop_message">
            {{ shopLis.foodScore }} <span>月售{{ shopLis.sellCount }}单</span>
            {{ shopLis.description }} 约{{ shopLis.deliveryTime }}分钟 距离{{
              shopLis.distance
            }}
          </p>
          <div class="select">
            <span>首单</span>
            <select class="overflow">
              <option
                value="新用户下单立减17元(不与其他活动同用)等8个优惠"
                title="新用户下单立减17元(不与其他活动同用)等8个优惠"
                v-if="shopLis.supports"
              >
                {{ shopLis.supports[0].content }}
              </option>
            </select>
          </div>
        </div>
      </div>
    </div>
    <transition name="fade">
      <div class="dialogBox" v-show="showAlert">
        <div class="bgColor">
          <div class="title">
            <h3><strong class="tit_pic">品牌</strong>{{ shopLis.name }}</h3>
          </div>
          <div class="adress">
            <div class="item">
              <span>{{ shopLis.foodScore }}</span>
              <span>评分</span>
            </div>
            <div class="item">
              <span>{{ shopLis.sellCount }}单</span>
              <span>月售</span>
            </div>
            <div class="item">
              <span>{{ shopLis.description }}</span>
              <span>约20分钟</span>
            </div>
            <div class="item">
              <span>{{ shopLis.deliveryPrice }}元</span>
              <span>配送费用</span>
            </div>
            <div class="item">
              <span>{{ shopLis.distance }}</span>
              <span>距离</span>
            </div>
          </div>
          <span class="announcement">—— 公告 ——</span>
          <div class="pro_introduce">
            <p class="pro_text">
              {{ shopLis.bulletin }}
            </p>
          </div>
        </div>

        <div class="closeDialog" @click="closeDialog">x</div>
      </div>
    </transition>
    
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data() {
    return {
      // 弹窗
      showAlert: false
    }
  },
  methods: {
    gotoMiste() {
      this.$router.push('/msite')
    },
    showChange() {
      this.showAlert = !this.showAlert
    },
    // 关闭对话框
    closeDialog() {
      this.showAlert = false
    }
  },
  computed: {
    ...mapState(['shopLis'])
  }
}
</script>

<style lang="less" scoped>
.pro_introduce {
  padding: 0 0.233333rem;
  p {
    padding-top: 0.266667rem;
    line-height: 0.483333rem;
    letter-spacing: 0.0703333rem;
    font-size: 0.3rem;
  }
}
// 渐显效果
.fade-enter {
  opacity: 0.5;
}
.fade-enter-active {
  transition: opacity 1s;
}
// 渐隐效果
.fade-enter {
  opacity: 0;
}
.fade-enter-active {
  transition: opacity 1s;
}
.fade-leave-to {
  opacity: 0;
}
.fade-leave-active {
  transition: opacity 1s;
}
.announcement {
  display: block;
  text-align: center;
  font-size: 0.3rem;
  color: #ccc;
}
.adress {
  display: flex;
  margin: 0.573333rem 0;
  .item {
    flex: 20%;
    display: flex;
    flex-direction: column;
    span {
      display: flex;
      justify-content: center;
      &:nth-child(1) {
        color: black;
        font-size: 0.353333rem;
        font-weight: 600;
        padding-bottom: 0.213333rem;
      }
    }
  }
}
.dialogBox {
  position: fixed;
  top: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  .bgColor {
    height: 6rem;
    width: 8.333333rem;
    background-color: #fff;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 5%;
    padding-bottom: 0.296667rem;
    .title {
      text-align: center;
      margin-top: 0.566667rem;
      h3 {
        font-size: 0.54rem;
        font-weight: 650;
        .tit_pic {
          height: 0.533333rem;
          width: 1.066667rem;
          background-color: yellow;
          border-radius: 0.133333rem;
          font-size: 0.4526667rem;
          display: inline-block;
          vertical-align: middle;
          margin-right: 0.213333rem;
        }
      }
    }
  }
  .closeDialog {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 70%;
    height: 1.333333rem;
    width: 1.333333rem;
    border-radius: 50%;
    border: 0.026667rem solid #fff;
    text-align: center;
    line-height: 1.333333rem;
    font-size: 1.233333rem;
    color: white;
  }
}
.icon {
  color: white;
  position: absolute;
  left: 0.133333rem;
  top: 0.306667rem;
  i {
    font-size: 0.453333rem;
  }
}
.header {
  display: flex;
  justify-content: center;
  padding-top: 0.566667rem;
  .title {
    display: flex;
    align-items: center;
    strong {
      font-size: 0.6rem;
      font-weight: 550;
      color: black;
    }
    .pro_pin {
      display: inline-block;
      height: 0.7rem;
      width: 1.066667rem;
      background-color: #ffd930;
      font-size: 0.38rem;
      color: black;
      line-height: 0.7rem;
      text-align: center;
      margin-right: 0.213333rem;
    }
    .icon_nav {
      height: 0;
      width: 0;
      border: 0.15rem solid transparent;
      border-left-color: black;
      margin-left: 0.266667rem;
    }
  }
}
.backImg {
  img {
    width: 100%;
    height: 2.333333rem;
  }
}
.header_logo {
  position: absolute;
  top: 0.8rem;
  left: 50%;
  transform: translateX(-50%);

  img {
    height: 2.066667rem;
    width: 2.066667rem;
  }
}

.txt {
  text-align: center;
  padding-bottom: 0.133333rem;
  .select {
    border: 0.026667rem solid #ccc;
    width: 7.5rem;
    margin: 0.266667rem auto;
    span {
      display: inline-block;
      height: 0.433333rem;
      width: 0.696667rem;
      background-color: greenyellow;
      text-align: center;
      line-height: 0.43333rem;
      vertical-align: middle;
      font-size: 0.28rem;
    }
  }
  .first_shop {
    height: 0.533333rem;
    width: 1.333333rem;
    display: inline-block;
    background-color: chartreuse;
  }
  .shop_message {
    font-size: 0.406667rem;
    margin-top: 0.533333rem;
    span {
      color: black;
    }
  }
  select {
    width: 6.666667rem;
    height: 0.533333rem;
    font-size: 0.28rem;
  }
}
</style>
